package my.study.c.consul.consumer.app.common.service;

import com.fasterxml.jackson.databind.JsonNode;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.NameValuePair;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

public interface HttpRequestService {

    String postFormDataAsync(String uri, HttpEntity httpEntity) throws ExecutionException, InterruptedException, IOException;

    String postFormUrlencodedAsync(String uri, List<NameValuePair> pairs) throws ExecutionException, InterruptedException, IOException;

    String postJsonAsync(String uri, String jsonData) throws ExecutionException, InterruptedException;

    String requestAsync(SimpleHttpRequest request) throws ExecutionException, InterruptedException;

    String requestAsync(SimpleHttpRequest request, RequestConfig requestConfig) throws ExecutionException, InterruptedException;


    String postJson(String uri, String jsonData) throws Exception;

    String post(HttpPost post) throws Exception;

    String post(HttpPost post, RequestConfig requestConfig) throws Exception;

    JsonNode post(String uri, Map<String, Object> map) throws Exception;

    String getAsync(String uri) throws ExecutionException, InterruptedException;
}
